<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="../layout/admin_template.xhtml">
                       
<ui:define name="body">
    
    <s:button view="/admin/editSnackShop.xhtml" value="新建快餐店" styleClass="inputButton">
    	<f:param name="snackShopId" value="" />
    </s:button>
    <h:messages globalOnly="true" styleClass="message"/>
    <h:form id="registerForm">

        <rich:panel>
            <f:facet name="header">快餐店查询</f:facet>
    
            <s:decorate id="loginNameDecoration" template="../layout/edit.xhtml">
                <ui:define name="label">店名</ui:define>
                <h:inputText id="shopName" value="#{exampleSnackShop.name}"/>
            </s:decorate>
            <div style="clear:both"/>
            
        </rich:panel>
        <div class="actionButtons">
            <h:commandButton id="register" value="查找" action="/admin/snackShopList.xhtml" styleClass="inputButton"/>                   
        </div>
    </h:form>
    
    <rich:panel>
        <f:facet name="header">查询结果</f:facet>
        
        <div class="results">
            <h:outputText value="没找到！" 
                       rendered="#{empty snackShopListAction.resultList}" styleClass="message"/>
            <table class="resultTable" width="100%">
            	<tr>
	            	<th>店名</th>
	            	<th>电话号码</th>
	            	<th>地址</th>
	            	<th>操作</th>	            	
            	</tr>
            	<ui:repeat value="#{snackShopListAction.resultList}" var="shop">
            		<tr>
	            		<td>
		            		<s:link view="/admin/editSnackShop.xhtml" value="#{shop.name}">
		            			<f:param name="snackShopId" value="#{shop.id}" />
		            		</s:link>
	            		</td>
	            		<td>#{shop.telNo}</td>
	            		<td>#{shop.address}</td>
	            		<td>
		            		<s:link view="/admin/viewSnackShop.xhtml" value="添加菜">
		            			<f:param name="snackShopId" value="#{shop.id}" />
		            		</s:link>
	            		</td>	            		
					</tr>	            		
				</ui:repeat>
            </table>   
        </div>
        
      <!-- pagination control -->
      <div class="pagingControl">
      
        <s:link view="/admin/snackShopList.xhtml" rendered="#{snackShopListAction.previousExists}" value="&lt;&lt; 首页">
          <f:param name="firstResult" value="0"/>
        </s:link>
        
        <s:link view="/admin/snackShopList.xhtml" rendered="#{snackShopListAction.previousExists}" value="&lt; 上一页">
          <f:param name="firstResult" value="#{snackShopListAction.previousFirstResult}"/>
        </s:link>
        
        <s:link view="/admin/snackShopList.xhtml" rendered="#{snackShopListAction.nextExists}" value="下一页 &gt;">
          <f:param name="firstResult" value="#{snackShopListAction.nextFirstResult}"/>
        </s:link>
        
        <s:link view="/admin/snackShopList.xhtml" rendered="#{snackShopListAction.nextExists}" value="最后一页 &gt;&gt;">
          <f:param name="firstResult" value="#{snackShopListAction.lastFirstResult}"/>
        </s:link>
        
      </div>
    </rich:panel>      
</ui:define>

</ui:composition>

